package handlers;

import javax.swing.*;

public class HeaderManager {
	public void footerSetter(JLabel[] labels, JButton btn) {
		cntFooter = labels[0];
		itemNumFooter = labels[1];
		cobrarBtn = btn;
		totalSales = labels[2];
		totalSalesNum = labels[3];
	}
	public void headerSetter(JLabel[] labels) {
		pos = labels;
	}
	
	//TODO Window Shaper
	public void showHeader(String sect) {
		switch(sect) {
		case "ventas":
			pos[0].setText("Codigo");
			pos[1].setText("Cnt");
			pos[2].setText("Articulo");
			pos[3].setText("Precio Unit");
			pos[4].setText("Importe");
			toggleSalesFooter(true);
			break;
		case "inventario":
			pos[0].setText("Codigo");
			pos[1].setText("Cnt");
			pos[2].setText("Articulo");
			pos[3].setText("             ");
			pos[4].setText("Precio Unit");
			toggleSalesFooter(false);
			break;
		case "clientes":
			pos[0].setText("ID");
			pos[1].setText("               ");
			pos[2].setText("Nombre");
			pos[3].setText("               ");
			pos[4].setText("Telefono");
			toggleSalesFooter(false);
			break;
		case "proveedores":
			pos[0].setText("ID");
			pos[1].setText("               ");
			pos[2].setText("Nombre");
			pos[3].setText("               ");
			pos[4].setText("Telefono");
			toggleSalesFooter(false);
			break;
		case "tiendas":
			pos[0].setText("ID");
			pos[1].setText("               ");
			pos[2].setText("Ubicacion");
			pos[3].setText("           ");
			pos[4].setText("Telefono");
			toggleSalesFooter(false);
			break;
		case "bodegas":
			pos[0].setText("ID");
			pos[1].setText("               ");
			pos[2].setText("Ubicacion");
			pos[3].setText("           ");
			pos[4].setText("Telefono");
			toggleSalesFooter(false);
			break;
		case "usuarios":
			pos[0].setText("Usuario");
			pos[1].setText("       ");
			pos[2].setText("Nombre");
			pos[3].setText("Departamento");
			pos[4].setText("    ");
			toggleSalesFooter(false);
			break;
		}	
	}
	
	//Footer
	private void toggleSalesFooter(boolean on) {
		cntFooter.setVisible(on);
		itemNumFooter.setVisible(on);
		cobrarBtn.setVisible(on);
		totalSales.setVisible(on);
		totalSalesNum.setVisible(on);
	}

	//TODO COMPONENTS
	//Footers
		//Sales
	private JLabel cntFooter;
	private JLabel itemNumFooter;
	private JButton cobrarBtn;
	private JLabel totalSales;
	private JLabel totalSalesNum;
	//Header
	private JLabel[] pos;
}
